Universal and adaptive de-mosaicing (CFA) system

ABSTRACT

A method of de-mosaicing pixel data from an image processor includes generating a pixel block that includes a plurality of image pixels. The method also includes determining a first image gradient between a first set of pixels of the pixel block and a second image gradient between a second set of pixels of the pixel block. The method also includes determining a first adaptive threshold value based on intensity of a third set of pixels of the pixel block. The pixels of the third set of pixels are adjacent to one another. The method also includes filtering the pixel block in a vertical, horizontal, or neutral direction based on the first and second image gradients and the first adaptive threshold value utilizing a plurality of FIR filters to generate a plurality of component images.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of U.S. Non-Provisional patentapplication Ser. No. 16/438,876, filed Jun. 12, 2019, which is acontinuation of U.S. Non-Provisional patent application Ser. No.15/349,609, filed Nov. 11, 2016 (now U.S. Pat. No. 10,366,471), whichclaims priority to U.S. Provisional Patent Application No. 62/262,316,filed Dec. 2, 2015, titled “Universal And Adaptive De-Mosaicing (CFA)Algorithm,” which both are hereby incorporated herein by reference inits entirety.

BACKGROUND

In digital image processing an image sensor typically is overlaid with acolor filter array (CFA) comprised of a mosaic of color filters. Themosaic of color filters are configured to filter the light passingthrough the mosaic of filters, and thus received by the image sensor, bywavelength. A de-mosaicing or CFA interpolation algorithm is thenutilized to generate a full color image from the raw image sensorcaptured data. Conventional de-mosaicing techniques utilize a uniquealgorithm that is tuned for a given CFA format (e.g., Bayer, Red/Clearcolor filter (RCCC), etc.).

SUMMARY

The problems noted above are solved in large part by systems and methodsof de-mosaicing pixel data from an image sensor. In some embodiments, animage signal processor includes a plurality of finite impulse response(FIR) filters, a first programmable gradient calculation circuit, afirst threshold calculation circuit, and a filter determination circuit.The FIR filters are configured to receive a pixel block that includes aplurality of raw input image pixels from an image sensor. The FIRfilters are also configured to filter the pixel block to generate aplurality of component images. The first programmable gradientcalculation circuit is configured to determine a first image gradientbetween a first set of pixels of the pixel block and a second imagegradient between a second set of pixels of the pixel block. The pixelsof the first set of pixels are adjacent to one another. The pixels ofthe second set of pixels are adjacent to one another. The firstthreshold calculation circuit is configured to determine a firstadaptive threshold value based on intensity of a third set of pixels ofthe pixel block. The pixels of the third set of pixels are adjacent toone another. The filter determination circuit is configured to determinea type of each of the plurality of FIR filters based on the first andsecond image gradients and the first adaptive threshold value.

Another illustrative embodiment is an image processing system thatincludes a filter array, an image sensor coupled to the filter array,and an image sub-system. The filter array is configured to filterelectromagnetic waves. The image sensor includes a plurality of pixelsensors. Each of the pixel sensors is configured to receive theelectromagnetic waves after being filtered by the filter array andconvert the received electromagnetic waves into electrical signals basedon the intensity of the electromagnetic waves at each pixel sensor togenerate a plurality of image pixels. The image sub-system includes animage signal processor. The image signal processor is configured togenerate a pixel block that includes the plurality of image pixels. Theimage signal processor is also configured to determine a first imagegradient between a first set of pixels of the pixel block and a secondimage gradient between a second set of pixels of the pixel block. Thepixels of the first set of pixels are adjacent to one another. Thepixels of the second set of pixels are adjacent to one another. Theimage signal processor is also configured to determine a first adaptivethreshold value based on intensity of a third set of pixels of the pixelblock. The pixels of the third set of pixels are adjacent to oneanother. The image signal processor is also configured to filter thepixel block in a vertical, horizontal, or neutral direction based on thefirst and second image gradients and the first adaptive threshold valueutilizing a plurality of FIR filters to generate a plurality ofcomponent images.

Yet another illustrative embodiment is a method of de-mosaicing pixeldata from an image sensor. The method includes generating a pixel blockthat includes a plurality of image pixels. The method also includesdetermining a first image gradient between a first set of pixels of thepixel block and a second image gradient between a second set of pixelsof the pixel block. The pixels of the first set of pixels are adjacentto one another. The pixels of the second set of pixels are adjacent toone another. The method also includes determining a first adaptivethreshold value based on intensity of a third set of pixels of the pixelblock. The pixels of the third set of pixels are adjacent to oneanother. The method also includes filtering the pixel block in avertical, horizontal, or neutral direction based on the first and secondimage gradients and the first adaptive threshold value utilizing aplurality of FIR filters to generate a plurality of component images.

BRIEF DESCRIPTION OF THE DRAWINGS

For a detailed description of various examples, reference will now bemade to the accompanying drawings in which:

FIG. 1 shows an illustrative block diagram of an image processing systemin accordance with various examples;

FIG. 2 shows an illustrative block diagram of an image sub-systemincluded in an image processing system in accordance with variousexamples;

FIG. 3 shows an illustrative block diagram of a CFA de-mosaic circuitincluded in an image signal processor of an image processing system inaccordance with various examples;

FIG. 4 shows an illustrative block diagram of a gradient calculationcircuit included in a CFA de-mosaic circuit of an image processingsystem in accordance with various examples;

FIG. 5 shows an illustrative block diagram of a threshold calculationcircuit included in a CFA de-mosaic circuit of an image processingsystem in accordance with various examples; and

FIG. 6 shows an illustrative flow diagram of a method of de-mosaicingpixel data from an image sensor in accordance with various examples.

NOTATION AND NOMENCLATURE

Certain terms are used throughout the following description and claimsto refer to particular system components. As one skilled in the art willappreciate, companies may refer to a component by different names. Thisdocument does not intend to distinguish between components that differin name but not function. In the following discussion and in the claims,the terms “including” and “comprising” are used in an open-endedfashion, and thus should be interpreted to mean “including, but notlimited to . . . .” Also, the term “couple” or “couples” is intended tomean either an indirect or direct connection. Thus, if a first devicecouples to a second device, that connection may be through a directconnection, or through an indirect connection via other devices andconnections. The recitation “based on” is intended to mean “based atleast in part on.” Therefore, if X is based on Y, X may be based on Yand any number of other factors.

DETAILED DESCRIPTION

The following discussion is directed to various embodiments of thedisclosure. Although one or more of these embodiments may be preferred,the embodiments disclosed should not be interpreted, or otherwise used,as limiting the scope of the disclosure, including the claims. Inaddition, one skilled in the art will understand that the followingdescription has broad application, and the discussion of any embodimentis meant only to be exemplary of that embodiment, and not intended tointimate that the scope of the disclosure, including the claims, islimited to that embodiment.

In digital image processing an image sensor typically is overlaid with acolor filter array (CFA) comprised of a mosaic of color filters. Themosaic of color filters are configured to filter the light passingthrough the mosaic of filters, and thus received by the image sensor, bywavelength. A de-mosaicing or CFA interpolation algorithm is thenutilized to generate a full color image from the raw image sensorcaptured data. Conventional de-mosaicing techniques utilize a uniquealgorithm that is tuned for a given CFA format (e.g., Bayer, Red/Clearcolor filter (RCCC), etc.). Additional color processing is thenperformed on the de-mosaiced images. However, different topologies havebegun to emerge with multiple new sensor formats emerging. Conventionalcolor processors require different algorithms for generating visualimages and for analytic data for use by machines. As such, there is aneed for a scalable flexible solution to address current and futureimage sensors and filters.

FIG. 1 shows an illustrative block diagram of an image processing system100 in accordance with various examples. The image processing system 100may include a lens 102, CFA 104, image sensor 106, and image sub-system108. Electromagnetic waves 150 are configured to pass through lens 102to be filtered by CFA 104 prior to being captured by the image sensor106. The electromagnetic waves 150 may include visible light of variouscolors, infrared waves, ultraviolet waves, microwaves, radio waves,etc., or any combination thereof. Lens 102 may be any type oftransmissible optical device that is configured to focus theelectromagnetic waves 150 onto the image sensor 106 via the CFA 104. Forexample, lens 102 may be a simple lens, a compound lens, a microwavelens, an electron lens, an acoustic lens, etc.

CFA 104 may be a mosaic of filters configured to filter theelectromagnetic waves 150 by wavelength. For example, CFA 104 may be aBayer filter. In a Bayer filter, a mosaic of visible light filters arearranged, such that 50% of the filters allow green light through thefilter, 25% allow red light through the filter, and 25% allow blue lightthrough the filter. Furthermore, the pattern of green, red, and bluefilters make up a 2×2 grid pattern (i.e., for any given four adjacent2×2 pixels, 2 filters are green filters, 1 filter is a red filter, and 1filter is a blue filter). In alternative embodiments, CFA 104 may be anyother type of filter, such as a RGBE (red, green, blue, emerald) filter,a RCCC filter, a RGB-IR (red, green, blue, infrared) filter, etc. andmay be in the form of a 2×2 grid, 4×4 grid, etc.

Each of the filters in the CFA 104 may be arranged to cover a singlepixel sensor of image sensor 106. Image sensor 106 may be any type ofimaging sensor that is comprised of a plurality of pixel sensors, eachconfigured to convert the filtered electromagnetic waves 152 intoelectrical signals based on the intensity of the receivedelectromagnetic waves. In some embodiments, the image sensor 106 is asemiconductor charge-coupled device (CCD) while, in alternativeembodiments, the image sensor 106 includes active pixel sensors on acomplementary metal-oxide-semiconductor (CMOS) sensor chip. Because eachpixel sensor is covered by a filter of the CFA 104, each pixel sensordetects the intensity of a specific type of electromagnetic wave. Forexample, some pixel sensors of the image sensor 106 may detect theintensity of blue visible light, some pixel sensors of the image sensor106 may detect the intensity of red visible light, some pixel sensors ofthe image sensor 106 may detect the intensity of infrared light, etc.

The image sub-system 108 is configured to receive the raw pixel data 154detected by the pixel sensors of the image sensor 106 and provide imageprocessing to the raw pixel data to improve visual quality of thecaptured image and output full color image 160 from the captured data.More particularly, the image sub-system 108 includes circuits thatsupport heterogeneous sensor architecture (i.e., sensors that includetwo different types of electromagnetic waves, e.g., visual light andinfrared light).

FIG. 2 shows an illustrative block diagram of image sub-system 108included in image processing system 100 in accordance with variousexamples. The image sub-system 108 may include a sensor interface 202,an image signal processor 204, and a host processor 206. The sensorinterface 202 may be a controller for interfacing with the image sensor106 to enable the image sub-system 108 to receive the raw pixel data154. The sensor interface 202 may be a parallel interface or a serialinterface. In embodiments where sensor interface 202 is a parallelinterface, the sensor interface 202 may consist of a parallel buscontaining video data along with HSync and Vsync signals per the ITU-Tstandards to enable receiving the raw pixel data 154. In embodimentswhere sensor interface 202 is a serial interface, the sensor interface202 may support receiving the raw pixel data 154 serially utilizinglow-voltage differential signaling (LVDS).

The image signal processor 204 may include a CFA de-mosaic circuit 212and a color correction circuit 214. The CFA de-mosaic circuit 212 isconfigured to de-mosaic the raw pixel data 154. In other words, the CFAde-mosaic circuit 212 is configured to perform CFA interpolation of theraw pixel data 154 to generate component images 252. Each componentimage 252 is interpolated raw pixel data for a single component of theraw pixel data to form a complete image in the single component. Forexample, if the CFA 104 is a Bayer filter, then one component imagewould be a complete image of the intensity of red light as captured bythe image sensor 106. Because only 25% of the pixels will include dataindicative of the intensity of red light, the de-mosaic circuit 212interpolates the intensity of red light for the pixels that havefiltered the red light. In other words, the CFA de-mosaic circuit 212performs interpolation of the red light component at every pixelposition from the image sensor 106. A second component image would be acomplete image of the intensity of blue light as captured by the imagesensor 106 in a similar manner. A third component image would be acomplete image of the intensity of green light as captured by the imagesensor 106 in a similar manner. A component image 252 may be a completeimage of the intensity of infrared light as captured by the image sensor106 as well. The CFA de-mosaic circuit 212 may also perform edgedetection to find the boundaries of objects within an image captured bythe image sensor 106. More particularly, the CFA de-mosaic circuit 212may determine a direction of any image edges within the image capturedby the image sensor 106 by determining gradients between pixels of theimage and processing that information. Based on the direction of theedge, or if no edge is detected, a particular FIR filter (e.g., avertical FIR filter, a horizontal FIR filter, a neutral FIR filter) maybe utilized to generate each component image 252.

The color correction circuit 214 may be configured to provide colorcorrection by combining the component images 252 into a single fullcolor image 160 for the captured electromagnetic waves 150. In someembodiments, the color correction circuit 214 may perform whitebalancing and a color conversion utilizing matrix multiplication togenerate the full color image 160. The host processor 206, may beconfigured to control the image sub-system 108. Both the image signalprocessor 204 and/or the host processor 206 may be any hardware thatcarries out computer instructions by performing, for example,arithmetic, logical, and input/output (I/O) operations. Image signalprocessor 204 and/or host processor 206 may include a central processingunit (CPU), a semiconductor-based microprocessor, a graphics processingunit (GPU), a digital signal processor (DSP), and/or other hardwaredevices suitable for retrieval and execution of instructions that may bestored in memory. Additionally, image signal processor 204 and/or thehost processor 206 may include a single processor, multiple processors,a single computer, a network of computers, or any other type ofprocessing device. For example, image signal processor 204 and/or thehost processor 206 may include multiple cores on a chip, multiple coresacross multiple chips, multiple cores across multiple devices, orcombinations thereof. Image signal processor 204 and/or the hostprocessor 206 may include at least one integrated circuit (IC), othercontrol logic, other electronic circuits, or combinations thereof thatinclude a number of electronic components.

FIG. 3 shows an illustrative block diagram of CFA de-mosaic circuit 212included in image signal processor 204 of image processing system 100 inaccordance with various examples. The CFA de-mosaic circuit 212 mayinclude line memory 302 a-e, gradient calculation circuits 306-308,threshold calculation circuits 310-312, filter determination circuit314, and FIR filter bands 316 which may include FIR filters 318 a-d.Each of the FIR filters 318 a-d may use a 6×6 kernel (or other sizekernel) to generate the component images 252 a-d. Therefore, a 6×6 (orother size, the same size as the kernel) pixel block 304 is stored inlocal memory. The pixel block 304 includes neighboring (i.e., adjacent)pixels received from the image sensor 106. In this example, six rows ofadjacent pixels and six columns of the corresponding adjacent pixelscomprise the pixel block 304. Thus, pixel block 304 includes, in thisexample, 36 adjacent pixels. The memory architecture of the CFAde-mosaic circuit 212 may be line based; therefore, the CFA de-mosaiccircuit 212 acts as a streaming engine. Thus, one incoming line of data154 and 5 memory lines (or buffers) 302 a-e may be utilized to generatethe pixel block 304.

The gradient calculation circuit 306 is configured to determine a firstimage gradient between a first set of pixels of the pixel block 304 anda second image gradient between a second set of pixels of the pixelblock 304. In other words, the gradient calculation circuit 306 isconfigured to determine a directional change in the intensity or colorof adjacent pixels of the pixel block 304. The gradient calculationcircuit 306 may determine the first image gradient by determining avertical gradient between a set of pixels of the pixel block 304 and thesecond image gradient by determining a horizontal gradient between a setof pixels of the pixel block 304. Because the image sensor 106 maycapture different types of electromagnetic waves (e.g., visual light andinfrared light), a second gradient calculation circuit 308 may also beutilized to calculate gradient information from the pixel block 304 in asimilar manner as gradient calculation circuit 306 for pixelscorresponding to the different type of electromagnetic wave than thepixels that the gradient calculation circuit 306 determines thegradient. For example, gradient calculation circuit 306 may beconfigured to calculate the first and second image gradients of thevisual light data in the pixel block 304 while the gradient calculationcircuit 308 may be configured to calculate the first and second imagegradients of infrared light data in the pixel block 304. Furthermore,both the gradient calculation circuits 306-308 may be programmable suchthat gradient calculation circuits 306-308 may be programmed as to whichtype of electromagnetic wave corresponding pixels each of the gradientcalculation circuits 306-308 will determine the gradient. In this way,the CFA de-mosaic circuit 212 is able to determine the gradient forheterogeneous image sensors.

The threshold calculation circuit 310 is configured to determine a firstadaptive threshold value based on intensity of a third set of pixels ofthe pixel block 304. The adaptive threshold value is utilized by thefilter determination circuit 314 in determining whether an edge ispresent in the pixel block 304 at any given pixel. Like the gradientcalculation circuits 306-308, a second threshold calculation circuit 312may also be utilized to calculate an adaptive threshold value for pixelscorresponding to a different type of electromagnetic wave than thepixels that the threshold calculation circuit 310 determines thethreshold. For example, threshold calculation circuit 310 may beconfigured to calculate the adaptive threshold value of the visual lightdata in the pixel block 304 while the threshold calculation circuit 312may be configured to calculate the adaptive threshold value of infraredlight data in the pixel block 304. Furthermore, both the thresholdcalculation circuits 310-312 may be programmable such that thresholdcalculation circuits 310-312 may be programmed as to which type ofelectromagnetic wave corresponding pixels each of the thresholdcalculation circuits 310-312 will determine the threshold. In this way,the CFA de-mosaic circuit 212 is able to determine the adaptivethreshold utilized to determine whether an edge is present forheterogeneous image sensors.

The filter determination circuit 314 may be configured to determine thetype of FIR filter (i.e., vertical, horizontal, and/or neutral) tofilter the pixel block 304. The filter determination circuit 314 mayreceive the gradients determined by the gradient calculation circuits306-308 and the adaptive thresholds determined by the thresholdcalculation circuits 310-312. Based on the received gradients and thereceived adaptive thresholds, the filter determination circuit 314 maydetermine whether a vertical or horizontal edge is present in the pixelblock 304 and/or whether no edge is present in the pixel block 304.

For example, if the horizontal gradient is greater than the verticalgradient plus the adaptive threshold value, then the filterdetermination circuit 314 may determine that there is a horizontal edgepresent in the pixel block 304. If the filter determination circuit 314determines that a horizontal edge is present in the pixel block 304,then the filter determination circuit 314 may determine that a verticalFIR filter should be utilized to filter the pixel block 304. Similarly,if the vertical gradient is greater than the horizontal gradient plusthe adaptive threshold value, then the filter determination circuit 314may determine that there is a vertical edge present in the pixel block304. If the filter determination circuit 314 determines that a verticaledge is present in the pixel block 304, then the filter determinationcircuit 314 may determine that a horizontal FIR filter should beutilized to filter the pixel block 304. However, if the filterdetermination circuit 314 determines that the horizontal gradient is notgreater than the vertical gradient plus the adaptive threshold value andthat the vertical gradient is not greater than the horizontal gradientplus the adaptive threshold value, then the filter determination circuit314 may determine that there is no edge present in the pixel block 304.If the filter determination circuit 314 determines that no edge ispresent in the pixel block 304, then the filter determination circuit314 may determine that a neutral FIR filter should be utilized to filterthe pixel block 304. In alternative embodiments, the filterdetermination circuit 314 may be preprogrammed and/or reprogrammed todetermine that a horizontal, vertical, and/or neutral filter should beutilized without depending on the gradients determined by the gradientcalculation circuits 306-308 and/or the adaptive thresholds determinedby the threshold calculation circuits 310-312.

In some embodiments, the filter determination circuit 314 may determinethat the there is a horizontal edge, vertical edge, and/or no edgepresent in the pixel block 304 based on weighted values. For example, ifthe horizontal gradient is greater than the vertical gradient times aweighted value plus the adaptive threshold or if the horizontal gradienttimes a weighted value is greater than the vertical gradient times thesame or a different weighted value plus the adaptive threshold, then thefilter determination circuit 314 may determine that there is ahorizontal edge present in the pixel block 304. Similarly, if thevertical gradient is greater than the horizontal gradient times aweighted value plus the adaptive threshold or if the vertical gradienttimes a weighted value is greater than the horizontal gradient times thesame or a different weighted value plus the adaptive threshold, then thefilter determination circuit 314 may determine that there is a verticaledge present in the pixel block 304. However, if the filterdetermination circuit 314 determines that the horizontal gradient orthat the horizontal gradient times a weighted value is not greater thanthe vertical gradient times the same or a different weighted value plusthe adaptive threshold value and that the vertical gradient or thevertical gradient times a weighted value is not greater than thehorizontal gradient times the same or a different weighted value plusthe adaptive threshold value, then the filter determination circuit 314may determine that there is no edge present in the pixel block 304.

In order to effectuate a vertical, horizontal, and/or neutral FIRfilter, the filter determination circuit 314 may store a coefficienttable. The coefficient table may be a programmable table for each FIRfilter 318 a-d of the filter bands 316 in order to support differenttypes of image sensors. Furthermore, the coefficient table may storedifferent filter coefficients to support vertical filtering, horizontalfiltering, or neutral filtering. Thus, if the filter determinationcircuit 314 determines that a vertical FIR filter should be utilized tofilter pixel block 304 because a determination is made that there is ahorizontal edge present in the pixel block 304, then the filterdetermination circuit 314 provides the coefficient corresponding tovertical filtering to the filter bands 316 for vertical filtering. Ifthe filter determination circuit 314 determines that a horizontal FIRfilter should be utilized to filter pixel block 304 because adetermination is made that there is a vertical edge present in the pixelblock 304, then the filter determination circuit 314 provides thecoefficient corresponding to horizontal filtering to the filter bands316 for horizontal filtering. If the filter determination circuit 314determines that a neutral FIR filter should be utilized to filter pixelblock 304 because a determination is made that there is no edge presentin the pixel block 304, then the filter determination circuit 314provides the coefficient corresponding to neutral filtering to thefilter bands 316 for neutral filtering.

The FIR filters 318 a-d are configured to filter, utilizing thecoefficients provided by the filter determination circuit 314 the pixelblock 304 to generate a corresponding component image 252 a-d. Each FIRfilter 318 a-d is configured to generate a single component image 252a-d. For example, FIR filter 318 a is configured to generate componentimage 252 a by filtering, either vertically, horizontally, or neutrallybased on the filter coefficient provided by the filter determinationcircuit 314 pixels of pixel block 304 corresponding with one componentof the pixel grid. The FIR filters 318 b-d generate component images 252b-d in a similar manner. In the example shown in FIG. 3, a 2×2 grid isbeing filtered, thus, four FIR filters 318 a-d are utilized, one percomponent pixel in the 2×2 grid, to generate the component images 252a-d. However, in alternative embodiments, different size grids may beutilized. For example, if a 4×4 grid is being utilized, then 16 filtersmay be utilized, one per component pixel in the 4×4 grid, to generate 16component images.

FIG. 4 shows an illustrative block diagram of a gradient calculationcircuit 306 and/or 308 included in CFA de-mosaic circuit 212 of imageprocessing system 100 in accordance with various examples. As discussedabove, the gradient calculation circuits 306-308 may be configured todetermine a first image gradient between a first set of pixels of thepixel block 304 and a second image gradient between a second set ofpixels of the pixel block 304.

In some embodiments, the pixel columns 402-404 of the pixel block 304are utilized for determining the first image gradient (i.e., thevertical gradient 452). For example, the pixel column 402 may becomprised of pixels 422 a-f, and the pixel column 404 may be comprisedof pixels 424 a-f. The intensity of the electromagnetic wave detected bythe pixel sensor corresponding with pixel 422 a may be subtracted fromthe intensity of the electromagnetic wave detected by the pixel sensorcorresponding with pixel 422 c. Similarly, the intensity of theelectromagnetic wave detected by the pixel sensor corresponding withpixel 422 b may be subtracted from the intensity of the electromagneticwave detected by the pixel sensor corresponding with pixel 422 e whilethe intensity of the electromagnetic wave detected by the pixel sensorcorresponding with pixel 422 d may be subtracted from the intensity ofthe electromagnetic wave detected by the pixel sensor corresponding withpixel 422 f. The absolute value of these differences then may bedetermined and added together to generate a column 402 verticalgradient. Likewise, a column 404 vertical gradient may be determined.The intensity of the electromagnetic wave detected by the pixel sensorcorresponding with pixel 424 a may be subtracted from the intensity ofthe electromagnetic wave detected by the pixel sensor corresponding withpixel 424 c. Similarly, the intensity of the electromagnetic wavedetected by the pixel sensor corresponding with pixel 424 b may besubtracted from the intensity of the electromagnetic wave detected bythe pixel sensor corresponding with pixel 424 e while the intensity ofthe electromagnetic wave detected by the pixel sensor corresponding withpixel 424 d may be subtracted from the intensity of the electromagneticwave detected by the pixel sensor corresponding with pixel 424 f. Theabsolute value of these differences then may be determined and addedtogether to generate the column 404 vertical gradient. The column 402vertical gradient and the column 404 vertical gradient may then be addedtogether to determine the vertical gradient 452.

In some embodiments, the pixel rows 406-408 of the pixel block 304 areutilized for determining the second image gradient (i.e., the horizontalgradient 454). For example, the pixel row 406 may be comprised of pixels426 a-f, and the pixel row 408 may be comprised of pixels 428 a-f. Theintensity of the electromagnetic wave detected by the pixel sensorcorresponding with pixel 426 a may be subtracted from the intensity ofthe electromagnetic wave detected by the pixel sensor corresponding withpixel 426 c. Similarly, the intensity of the electromagnetic wavedetected by the pixel sensor corresponding with pixel 426 b may besubtracted from the intensity of the electromagnetic wave detected bythe pixel sensor corresponding with pixel 426 e while the intensity ofthe electromagnetic wave detected by the pixel sensor corresponding withpixel 426 d may be subtracted from the intensity of the electromagneticwave detected by the pixel sensor corresponding with pixel 426 f. Theabsolute value of these differences then may be determined and addedtogether to generate a row 406 horizontal gradient. Likewise, a row 408horizontal gradient may be determined. The intensity of theelectromagnetic wave detected by the pixel sensor corresponding withpixel 428 a may be subtracted from the intensity of the electromagneticwave detected by the pixel sensor corresponding with pixel 428 c.Similarly, the intensity of the electromagnetic wave detected by thepixel sensor corresponding with pixel 428 b may be subtracted from theintensity of the electromagnetic wave detected by the pixel sensorcorresponding with pixel 428 e while the intensity of theelectromagnetic wave detected by the pixel sensor corresponding withpixel 428 d may be subtracted from the intensity of the electromagneticwave detected by the pixel sensor corresponding with pixel 428 f. Theabsolute value of these differences then may be determined and addedtogether to generate the row 408 horizontal gradient. The row 406horizontal gradient and the row 408 horizontal gradient may then beadded together to determine the horizontal gradient 454. In alternativeembodiments, the gradient calculation circuits 306 and/or 308 maydetermine the gradients via different methods. As discussed previously,the vertical gradient 452 and the horizontal gradient 454 are providedto the filter determination circuit 314 for determining whether an edgeis present in the pixel block 304.

FIG. 5 shows an illustrative block diagram of threshold calculationcircuit 310 and/or 312 included in CFA de-mosaic circuit 212 of imageprocessing system 100 in accordance with various examples. As discussedabove, the threshold calculation circuits 310-312 may be configured todetermine the adaptive threshold values based on the intensity of athird set of pixels of the pixel block 304. In some embodiments, thepixels of pixel set 502 of the pixel block 304 are utilized fordetermining the adaptive threshold value. For example, the intensity ofthe electromagnetic wave detected by the pixel sensor corresponding withpixels of the pixel set 502 are summed. In some embodiments, the sum isright shifted by 4 (divided by 16) and then multiplied by a programmablemultiplication offset value. The product of the multiplication may beadded by a programmable addition offset value and then right shifted by12 (divided by 4096) to generate the adaptive threshold value. In thismanner, an adaptive threshold may be determined that is based on theintensity of the electromagnetic waves. Thus, the threshold value maychange based on whether the pixels are in a darker region of the imageor a lighter region of the image. Hence, in some embodiments, todetermine that an edge exists in the pixel block 304, the differencebetween the vertical gradient and the horizontal gradient needs to begreater in lighter areas of the image than in darker areas of the image.This provides efficient edge detection in different lighting.

FIG. 6 shows an illustrative flow diagram of a method 600 ofde-mosaicing pixel data from an image sensor in accordance with variousexamples. Though depicted sequentially as a matter of convenience, atleast some of the actions shown can be performed in a different orderand/or performed in parallel. Additionally, some embodiments may performonly some of the actions shown. In some embodiments, at least some ofthe operations of the method 600, as well as other operations describedherein, can be performed by the image signal processor 204 (includingthe de-mosaic circuit 212) and implemented in logic and/or by aprocessor executing instructions stored in a non-transitory computerreadable storage medium.

The method 600 begins in block 602 with generating a pixel block, suchas pixel block 304. For example, the memory architecture of a CFAde-mosaic circuit, such as CFA de-mosaic circuit 212, may be line based;therefore, the CFA de-mosaic circuit acts as a streaming engine utilizedto generate the pixel block. The pixel block includes any number ofneighboring (i.e., adjacent) pixels received from an image sensor. Thusfor example, a 6×6 pixel block comprises six rows of adjacent pixels andsix columns of the corresponding adjacent pixels for a total of 36adjacent pixels.

In block 604, the method 600 continues with determining a first and asecond image gradient. For example, a gradient calculation circuit, suchas gradient calculation circuits 306 and/or 308, is configured todetermine a first image gradient, a vertical gradient, between a firstset of pixels, such as pixels 422 a-f and 424 a-f, of the pixel block304 and a second image gradient, a horizontal gradient, between a secondset of pixels, such as pixels 426 a-f and 428 a-f, of the pixel block304.

The method 600 continues in block 606 with determining a thresholdvalue. For example, a threshold calculation circuit, such as thresholdcalculation circuits 310 and/or 312, is configured to determine anadaptive threshold value based on the intensity of a third set ofpixels, such as the pixels in pixel set 502, of the pixel block.

In block 608, the method 600 continues with filtering the pixel blockbased on the first and second image gradients and the threshold value.For example, a filter determination circuit, such as filterdetermination circuit 314, may determine that vertical, horizontal,and/or neutral filters should be utilized to filter the pixel blockbased on a comparison between the first image gradient and the secondimage gradient. Thus, in an embodiment, if the second gradient(horizontal gradient) is greater than the first gradient (verticalgradient) plus the adaptive threshold value, then the filterdetermination circuit may determine that a vertical FIR filter should beutilized to filter the pixel block. If the first gradient (verticalgradient) is greater than the second gradient (horizontal gradient) plusthe adaptive threshold value, then the filter determination circuit maydetermine that a horizontal FIR filter should be utilized to filter thepixel block. However, if the filter determination circuit determinesthat the second gradient (horizontal gradient) is not greater than thefirst gradient (vertical gradient) plus the adaptive threshold value andthat the first gradient (vertical gradient) is not greater than thesecond gradient (horizontal gradient) plus the adaptive threshold value,then the filter determination circuit may determine that a neutral FIRfilter should be utilized to filter the pixel block. A filter, such asany of filters 318 a-d, may then filter the pixel block in the vertical,horizontal, and/or neutral direction as determined by the filterdetermination circuit.

The above discussion is meant to be illustrative of the principles andvarious embodiments of the present disclosure. Numerous variations andmodifications will become apparent to those skilled in the art once theabove disclosure is fully appreciated. It is intended that the followingclaims be interpreted to embrace all such variations and modifications.

What is claimed is:
 1. A circuit, comprising: a line-based memoryincluding an input data line coupled to a first buffer of a plurality ofbuffers, wherein the plurality of buffers is serially coupled together;a first gradient circuit associated with a first type of adjacent pixelsthat correspond to a first type of electromagnetic wave, the firstgradient circuit coupled to the line-based memory and having a firstgradient output; a second gradient circuit associated with a second typeof adjacent pixels that correspond to a second type of electromagneticwave, the second gradient circuit coupled to the line-based memory andhaving a second gradient output; a first threshold circuit coupled tothe line-based memory and having a first threshold output; a secondthreshold circuit coupled to the line-based memory and having a secondthreshold output; a filter detector circuit coupled to the firstgradient output, the second gradient output, the first threshold output,and the second threshold output; and a plurality of filter bands coupledto the line-based memory and to an output of the filter detectorcircuit; wherein the first type of electromagnetic wave is a firstselection and the second type of electromagnetic wave is a secondselection, the first selection is different from the second selection,and the first selection and the second selection are selected from:visible light of various colors, infrared waves, ultraviolet waves,microwaves, or radio waves.
 2. The circuit of claim 1, wherein: theline-based memory is configured to store a pixel block.
 3. The circuitof claim 2, wherein: the first gradient circuit is configured todetermine a directional change in one of an intensity or a color of thefirst type of adjacent pixels of the pixel block based on a first and asecond set of pixels of the pixel block.
 4. The circuit of claim 3,wherein: the first threshold circuit is configured to determine a firstadaptive threshold value of the first type of adjacent pixels based onan intensity of a third set of pixels of the pixel block.
 5. The circuitof claim 2, wherein: the second gradient circuit is configured todetermine a directional change in one of an intensity or a color of thesecond type of adjacent pixels of the pixel block based on a fourth anda fifth set of pixels of the pixel block.
 6. The circuit of claim 5,wherein: the second threshold circuit is configured to determine asecond adaptive threshold value of the second type of adjacent pixelsbased on an intensity of a sixth set of pixels of the pixel block. 7.The circuit of claim 2, wherein: the filter detector circuit isconfigured to determine a presence of an edge in the pixel block basedon one of the first gradient output, the second gradient output, thefirst threshold output, and the second threshold output.
 8. The circuitof claim 7, wherein: in response to determining the presence of theedge, determining an orientation of the edge.
 9. The circuit of claim 8,wherein: a coefficient indicates a type of finite impulse response (FIR)filter based on one of the presence of the edge, the orientation of theedge, the first gradient output, the second gradient output, the firstthreshold output, and the second threshold output.
 10. The circuit ofclaim 9, wherein: the filter detector circuit includes a coefficienttable configured to store the coefficient.
 11. The circuit of claim 9,wherein: the output of the filter detector circuit includes thecoefficient.
 12. The circuit of claim 1, wherein: the plurality offilter bands includes a plurality of filters; and the plurality offilters are selected in response to the output of the filter detectorcircuit.